#include "Task.h"

namespace Impp {

Task::Task(TaskType type, Oscar* oscar, const TaskHandle  handleType, const qword  handle, time_t lifeTime) :
	oscar(oscar),handleType(handleType), type(type),handle(handle),createTime(wxDateTime::GetTimeNow()),lifeTime(lifeTime)
{
}

Task::~Task()
{
}

bool Task::handleEquals(const TaskHandle & type, const qword & handle){
	return this->handleType==type && this->handle==handle;
}

bool Task::checkForTimeOut(const time_t & now){
	if(now > createTime+lifeTime){
		timedOut();
		return true;
	}
	return false;
}

TaskType Task::getType(){
	return type;
}

qword Task::getHandle(){
	return handle;
}

void Task::packageHasToWait(){
	lifeTime+=500;
}

void Task::packageSent(){
	
}

}
